<template>
<div>
 <Table :columns="columns" :data="consList" row-key="id" :loading="loading"></Table>
     <div class="ivu-mt iuv-text-center">
            <Page :total="data.length" :current.sync="current" show-elevator show-sizer show-total></Page>
        </div>
 </div>
</template>
 <script>
    export default {
        name: 'manage',
        data () {
            return {
                loading: true,
                columns: [
                    {
                        title: '基本信息',
                        key: 'basic',
                        fixed: 'left',
                        width: 118
                    },
                    {
                        title: '挂号时间',
                        key: 'registerTime',
                        width: 118
                    },
                    {
                        title: '诊室',
                        key: 'room',
                        width: 70
                    },
                    {
                        title: '复诊次数',
                        key: 'furterNumber',
                        width: 100
                    },
                    {
                        title: '上次回访时间',
                        key: 'preTime',
                        width: 125
                    },
                    {
                        title: '回访总次数',
                        key: 'visitNumber',
                        width: 118
                    },
                    {
                        title: '上次来院时间',
                        key: 'notYetDay',
                        width: 125
                    },
                    {
                        title: '病种',
                        key: 'disease',
                        width: 100
                    },
                    {
                        title: '预到时间',
                        key: 'makeTime',
                        width: 125
                    },
                    {
                        title: '归属医助',
                        key: 'ascription',
                        width: 100
                    },
                    {
                        title: '区间消费',
                        key: 'sectionConsumption',
                        width: 100
                    },
                    {
                        title: '总消费',
                        key: 'consumption',
                        minWidth: 90
                    }
                ],
                data: [],
                current: 1,
                size: 10
            }
        },
        computed: {
            consList () {
                const data = this.data;
                const start = this.current * this.size - this.size;
                const end = start + this.size;
                return [...data].slice(start, end);
            }
        },
        mounted () {
            const data = [];
            setTimeout(() => {
                for (let i = 1; i <= 100; i++) {
                    data.push({
                        basic: '张在峰 男 26',
                        registerTime: '2020-05-01',
                        room: Math.round(Math.random() * 3 + 1) + '诊',
                        furterNumber: Math.round(Math.random() * 10),
                        preTime: '2020-05-23',
                        visitNumber: Math.round(Math.random() * 10),
                        notYetDay: '2020-05-21',
                        disease: '白癜风',
                        makeTime: '2020-06-01',
                        ascription: '王艳',
                        sectionConsumption: '2358',
                        consumption: '12358'
                    })
                }
                this.data = data;
                this.loading = false;
            }, 1000)
        }
    }
</script>
